package com.dycx.api.controller.manage.system;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dycx.common.RestResponse;
import com.dycx.system.dto.AppVersionDTO;
import com.dycx.system.enums.AppEnum;
import com.dycx.system.service.AppVersionService;
import com.dycx.system.vo.AppVersionVO;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;


/**
 * (AppVersion)表控制层
 *
 * @author wuzongbin
 * @since 2023-12-04 22:58:54
 */
@RestController
@RequestMapping(value = "/manage/system/AppVersion")
public class AppVersionController {
    /**
     * 服务对象
     */
    @Resource
    private AppVersionService appVersionService;

    /**
     * 分页
     **/
    @PostMapping("/getPage")
    public RestResponse<Page<AppVersionVO>> getPage(@RequestBody AppVersionDTO dto) {
        return RestResponse.success(appVersionService.getPage(dto));
    }

    /**
     * 查询详细
     **/
    @GetMapping("/load")
    public RestResponse<AppVersionVO> load(Integer id) {
        return RestResponse.success(appVersionService.load(id));
    }

    /**
     * 添加
     **/
    @PostMapping("/create")
    public RestResponse<Boolean> create(@RequestBody @Valid AppVersionDTO dto) {
        return appVersionService.create(dto) ? RestResponse.success() : RestResponse.fail();
    }

    /**
     * 修改
     **/
    @PostMapping("/edit")
    public RestResponse<Boolean> edit(@RequestBody @Valid AppVersionDTO dto) {
        return appVersionService.edit(dto) ? RestResponse.success() : RestResponse.fail();
    }


    /**
     * 刪除
     **/
    @GetMapping("/delete")
    public RestResponse<Boolean> delete(Integer id) {
        return appVersionService.delete(id) ? RestResponse.success() : RestResponse.fail();
    }

}

